/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package org.jackysoft.entity;

import java.util.Collection;







import org.dom4j.Element;
import org.jackysoft.bean.define.EntitySchemas;

/**
 * Date: May 12, 2004 Time: 9:04:25 AM
 * 
 * 
 */



public class ConditionsNode extends AbstractNode {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6622703641008100879L;
	// ~ Instance fields
	// ////////////////////////////////////////////////////////

	private Collection<ConditionNode> conditions;
	private String type;

	// ~ Constructors
	// ///////////////////////////////////////////////////////////

	/**
     * 
     */
	public ConditionsNode() {
	}

	public ConditionsNode(Element element) {
		super(element);
	}

	@Override
	public Element asElement() {
		Element root = elementof("conditions");
		attr(root, "id", id);
		attr(root, "type", type);
		addchildren(root, this.conditions);
		return root;
	}

	// ~ Methods
	// ////////////////////////////////////////////////////////////////

	
	
	
	
	public Collection<ConditionNode> getConditions() {
		return conditions;
	}

	public String getType() {
		return type;
	}

	@Override
	protected void init(Element root) {
		this.type = stringAttr(root, "type");
		this.conditions = childrenof(root, "condition", ConditionNode.class);
	}

	public void setConditions(Collection<ConditionNode> conditions) {
		this.conditions = conditions;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
	public String tagName() {
		// TODO Auto-generated method stub
		return "conditions";
	}

}
